package com.tuanzi.loan.business.service.family.impl;

import com.tuanzi.loan.business.entity.family.LoanNewCreditCardInfo;
import com.tuanzi.loan.business.repository.family.LoanNewCreditCardInfoRepository;
import com.tuanzi.loan.business.service.family.LoanNewCreditCardInfoService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.family.LoanNewCreditCardInfoRequest;
import com.tuanzi.loan.vo.response.family.LoanNewCreditCardInfoResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * User: liangZongXi
 * Create time: 17:34 2018/8/31
 * Description:
 */
@Debug
@Service
@Transactional
@Retryable(value = {RetryException.class})
public class LoanNewCreditCardInfoServiceImpl extends BaseAuditServiceImpl<LoanNewCreditCardInfo, Long> implements LoanNewCreditCardInfoService {

    private final LoanNewCreditCardInfoRepository loanNewCreditCardInfoRepository;

    @Autowired
    public LoanNewCreditCardInfoServiceImpl(LoanNewCreditCardInfoRepository loanNewCreditCardInfoRepository) {
        this.loanNewCreditCardInfoRepository = loanNewCreditCardInfoRepository;
    }

    @Override
    protected JPAAuditRepository<LoanNewCreditCardInfo, Long> getRepository() {
        return loanNewCreditCardInfoRepository;
    }

    @Override
    public Page<LoanNewCreditCardInfoResponse> list(PageSearcher<LoanNewCreditCardInfoRequest> pageSearcher) {
        return loanNewCreditCardInfoRepository.list(pageSearcher.getSearchCondition(),pageSearcher.getPageable());
    }
}

